package collention;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class GenericDemo {
    public static void main(String[] args) {
        /*Collection<String> C=new ArrayList<>();
        C.add("one");
        C.add("two");
        C.add("there");
        C.add("four");
        C.add("five");
        C.add("six");
        C.add("seven");
        Iterator<String> it=C.iterator();
        while(it.hasNext()){
            String str=it.next();
            System.out.println(str);
        }
        for(String str:C){
            System.out.println(str);
        }*/
        Collection<Point > EE=new ArrayList<>();
        EE.add(new Point(1,2));
        EE.add(new Point(2,3));
        EE.add(new Point(3,4));
        EE.add(new Point(5,6));
        Iterator<Point> it=EE.iterator();
        while(it.hasNext()){
            Point P=it.next();
            System.out.println(P);

        }
        for(Point P:EE){
            System.out.println(P);
        }

    }
}
